package com.googlecode.dgwt.client.dijit.resource.template;

import com.googlecode.dgwt.client.dijit.util.Template;
import com.googlecode.dgwt.client.dojo.base.BrowserSensitive;
import com.googlecode.dgwt.client.dojo.base.BrowserSensitive.ReplaceWith;
import com.googlecode.dgwt.client.dojo.base.BrowserSensitive.WhenUserAgent;

/**
 * A set of HTML templates used by DGWT framework. 
 * 
 * @author wellsantos@wellsantos.com
 * @author penetrol@gmail.com
 * @since 0.01
 */
@ReplaceWith({
    @WhenUserAgent(match="gecko\\v", type=TemplateResources_Gecko.class)
})
public class TemplateResources extends TemplateFragments implements BrowserSensitive {


    
    /**
     * @see com.googlecode.dgwt.client.dijit.form.TextBox 
     * @see com.googlecode.dgwt.client.dijit.form.PasswordTextBox 
     * @return template
     */
    public Template textBox(){
        return new Template(
            "<input" +
                " dojoAttachPoint='inputElement,focusableElement'" +
                " autocomplete='${autocomplete}'" +
                " type='${type}'" +
                " />"
        );
    }

    

    /**
     * @see com.googlecode.dgwt.client.dijit.form.Button 
     * @return template
     */
    public Template button(){
        return new Template(
            "<span" +
                " class='dijit dijitReset dijitLeft dijitInline'" +
                " >" +
                "<span" +
                    " class='dijitReset dijitRight dijitInline'" +
                    " >" +
                    "<span" +
                        " class='dijitReset dijitInline dijitButtonNode'" +
                        " >" +
                        "<button" +
                            " class='dijitReset dijitStretch dijitButtonContents'" +
                            " dojoAttachPoint='inputElement,focusableElement'" +
                            " type='button'" +
                            " value='${value}'" +
                            " waiRole='button'" +
                            " waiState='labelledby-${id}_label'" +
                            " >" +
                            "<span" +
                                " class='dijitReset dijitInline'" +
                                " dojoAttachPoint='iconElement'" +
                                " >" +
                                "<span" +
                                    " class='dijitReset dijitToggleButtonIconChar'" +
                                    " >" +
                                    "&#10003;" +
                                "</span>" +
                            "</span>" +
                            "<span" +
                                " class='dijitReset dijitInline dijitButtonText'" +
                                " id='${id}_label'" +
                                " dojoAttachPoint='containerElement,sizeableElement'" +
                                " >" +
                            "</span>" +
                        "</button>" +
                    "</span>" +
                "</span>" +
            "</span>"
        );
    }

    
    
    /**
     * @see com.googlecode.dgwt.client.dijit.layout.ScrollPanel
     * @return template
     */
    public Template scrollPanel() {
        return new Template(getScrollBox(""));
    }
    
    

    /**
     * @see com.googlecode.dgwt.client.dijit.form.ListBox
     * @return template
     */
    public Template indexedView() {
        return new Template(getScrollDiv(""));
    }
    
    

    /**
     * @see com.googlecode.dgwt.client.dijit.form.ListBox
     * @return template
     */
    public Template listBox() {
        return new Template(getSimpleTable(""));
    }
    
    

    /**
     * @see com.googlecode.dgwt.client.dojox.grid.Grid 
     * @return template
     */
    public Template grid() {
        return new Template(
                "<div" +
                    " class='dojoxGrid'" +
                    " hidefocus='hidefocus'" +
                    " wairole='grid'" +
                    //" dojoAttachEvent='onmouseout:_mouseOut'" +
                    " >" +
                    "<div" +
                        " class='dojoxGridMasterHeader'" +
                        " dojoAttachPoint='viewsHeaderNode'" +
                        " tabindex='-1'" +
                        " wairole='presentation'" +
                        " >" +
                    "</div>" +
                    "<div" +
                        " class='dojoxGridMasterView'" +
                        " dojoAttachPoint='viewsNode'" +
                        " wairole='presentation'" +
                        " >" +
                    "</div>" +
                    "<div" +
                        " class='dojoxGridMasterMessages'" +
                        " style='display: none;'" +
                        " dojoAttachPoint='messagesNode'" +
                        " >" +
                    "</div>" +
                    "<span" +
                        " dojoAttachPoint='lastFocusNode'" +
                        " tabindex='0'" +
                        " >" +
                    "</span>" +
                "</div>"
        );
    }
    
    public Template view(){
    	return new Template(
   "<div class='dojoxGridView' wairole='presentation'>"+
	"<div class='dojoxGridHeader' dojoAttachPoint='headerNode' wairole='presentation'>"+
		"<div dojoAttachPoint='headerNodeContainer' style='width:9000em' wairole='presentation'>"+
			"<div dojoAttachPoint='headerContentNode' wairole='row'></div>"+
		"</div>"+
	"</div>"+
	"<input type='checkbox' class='dojoxGridHiddenFocus' dojoAttachPoint='hiddenFocusNode' wairole='presentation' />"+
	"<input type='checkbox' class='dojoxGridHiddenFocus' wairole='presentation' />"+
	"<div class='dojoxGridScrollbox' dojoAttachPoint='scrollboxNode' wairole='presentation'>"+
		"<div class='dojoxGridContent' dojoAttachPoint='contentNode' hidefocus='hidefocus' wairole='presentation'></div>"+
	"</div>"+
   "</div>");
    	
    }
    
    
    
}
